package chapter04.d1_fileio.demo3;


import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectOutputStream;
import java.util.List;

/**
 * Created with IntelliJ IDEA.
 *
 * @Author: jack_yang
 * @Date: 2024/5/8
 * @Description: addition and subtraction
 */
public class FileSerializerTest {
        public static void main(String[] args) throws Exception {
            FileOutputStream fileOutputStream = new FileOutputStream("D:\\Student2.txt");
            ObjectOutputStream objectOutputStream = new ObjectOutputStream(fileOutputStream);
            List<Student> studentList = Student.getStudentList();
            objectOutputStream.writeObject(studentList); // 修改这里
            objectOutputStream.close(); // 这里也修改了
            System.out.println("序列化成功");
        }
    }


